<?php

namespace App\V3\V3_2_7\Models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class BarterLogisticsInfoModel extends Model
{


    use HasFactory;
    protected $table = 'barter_logistics_info';

    protected $dateFormat = 'U';//这个时间字段被为被格式化为UNIX 时间戳的形式存储

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }
    
    /**
     * 查询账号下所有换货物流信息
     * @param unknown $userId
     * @return unknown
     */
    static public function getBarterLogisticsInfo($userId){
        return SELF::select(
            'barter_id',
            'logistics_company',
            'logistics_order_no'
            )->where([
                $userId,
                'delete_flag'=>0
            ])->get()->toArray();
    }
}
